import React,{useRef,useEffect} from "react";
import { withRouter} from "react-router-dom"
function Element(prop,ref){
    console.log(prop);
    return <div >这里是测试数据</div>
}
// 

const FancyButton = React.forwardRef((props, ref) => (
    <Element ref={ref} />
  ));
function App(props){
    const ref=useRef()
    useEffect(()=>{
        console.log(ref.current);
    })
    return (
        <div>
            <div>这里是测试数据</div>
            <FancyButton ref={ref}>这里是ForwardRef的使用</FancyButton>
        </div>
    )
}



export default App